﻿using PetaPoco;
using PmSoft;
using PmSoft.Caching;
using System.ComponentModel;
using static Modules.BankSpecialAccount.BankSpecialAccountConstants;

namespace Modules.BankSpecialAccount.Entitys
{
    /// <summary>
    /// 项目专户信息
    ///</summary>
    [TableName("project_special_account")]
    [Description("项目工资专户信息")]
    [PrimaryKey("id", AutoIncrement = true)]
    [CacheSetting(true, PropertyNamesOfArea = "ProjectId")]
    [Serializable]
    public class BankSpecialAccountInfo : IEntity
    {
        /// <summary>
        ///
        ///</summary>
        [Column("id")]
        public int Id { get; set; }

        /// <summary>
        /// 项目ID
        ///</summary>
        [Column("project_id")]
        public int ProjectId { get; set; }

        /// <summary>
        /// 编号（流水号）
        ///</summary>
        [Column("code")]
        public string Code { get; set; }

        /// <summary>
        /// 银行操作员工号（开户）
        ///</summary>
        [Column("opt_user_code")]
        public string OptUserCode { get; set; }

        /// <summary>
        /// 银行操作员姓名（开户）
        ///</summary>
        [Column("opt_user_name")]
        public string OptUserName { get; set; }

        /// <summary>
        /// 专户签约时间
        ///</summary>
        [Column("account_create_time")]
        public DateTime? AccountCreateTime { get; set; }

        /// <summary>
        /// 申请时间
        ///</summary>
        [Column("create_time")]
        public DateTime CreateTime { get; set; }

        /// <summary>
        /// 账户名称
        ///</summary>
        [Column("username")]
        public string Username { get; set; }

        /// <summary>
        /// 开户日期
        ///</summary>
        [Column("open_date")]
        public DateTime? OpenDate { get; set; }

        /// <summary>
        /// 开户银行（银行代码）
        ///</summary>
        [Column("bank_type")]
        public string BankType { get; set; }

        /// <summary>
        /// 银行名称
        ///</summary>
        [Column("bank_name")]
        public string BankName { get; set; }

        /// <summary>
        /// 开户支行
        ///</summary>
        [Column("bank_subbranch")]
        public string BankSubbranch { get; set; }

        /// <summary>
        /// 开户人
        ///</summary>
        [Column("creator")]
        public string Creator { get; set; }

        /// <summary>
        /// 银行专户账号
        ///</summary>
        [Column("bank_no")]
        public string BankNo { get; set; }

        /// <summary>
        /// 开户地址
        ///</summary>
        [Column("bank_address")]
        public string BankAddress { get; set; }

        /// <summary>
        /// 银行是否对账户设置特殊标识(0否,1是)
        ///</summary>
        [Column("bank_mark")]
        public bool? BankMark { get; set; }

        /// <summary>
        /// 工资专户余额(元)
        ///</summary>
        [Column("balance")]
        public decimal? Balance { get; set; }

        /// <summary>
        /// 账户状态(1 开户中, 2 正常,3 补办,4 挂失,5 注销,6 冻结,7 其他)
        /// 默认值: 1
        ///</summary>
        [Column("account_status")]
        public 专户状态 AccountStatus { get; set; }


        /// <summary>
        /// 销户人
        ///</summary>
        [Column("canceller")]
        public string Canceller { get; set; }

        /// <summary>
        /// 销户人 工号
        ///</summary>
        [Column("cancel_no")]
        public string CancelNo { get; set; }

        /// <summary>
        /// 销户理由
        ///</summary>
        [Column("cancel_reason")]
        public string CancelReason { get; set; }

        /// <summary>
        /// 销户时间
        ///</summary>
        [Column("cancel_time")]
        public DateTime? CancelTime { get; set; }

        /// <summary>
        /// 建设单位审核人
        ///</summary>
        [Column("constructor_checker")]
        public string ConstructorChecker { get; set; }

        /// <summary>
        /// 建设单位审核人 证件类型
        ///</summary>
        [Column("constructor_type")]
        public string ConstructorType { get; set; }

        /// <summary>
        /// 建设单位电话
        ///</summary>
        [Column("constructor_mobile")]
        public string ConstructorMobile { get; set; }

        /// <summary>
        /// 建设单位审核员证件号码
        ///</summary>
        [Column("constructor_card_no")]
        public string ConstructorCardNo { get; set; }

        /// <summary>
        /// 总承包审核人
        ///</summary>
        [Column("lump_contractor_corp_checker")]
        public string LumpContractorCorpChecker { get; set; }

        /// <summary>
        /// 总承包审核人证件类型
        ///</summary>
        [Column("lump_contractor_corp_type")]
        public string LumpContractorCorpType { get; set; }

        /// <summary>
        /// 总承包电话
        ///</summary>
        [Column("lump_contractor_corp_mobile")]
        public string LumpContractorCorpMobile { get; set; }

        /// <summary>
        /// 总包审核员证件号码
        ///</summary>
        [Column("lump_contractor_corp_card_no")]
        public string LumpContractorCorpCardNo { get; set; }

        /// <summary>
        /// 最后一次更新时间
        ///</summary>
        [Column("last_update_time")]
        public DateTime? LastUpdateTime { get; set; }

        /// <summary>
        /// 银行账户最后交易日期
        ///</summary>
        [Column("last_trade_date")]
        public string? LastTradeDate { get; set; }

        /// <summary>
        /// 银行账户最后交易时间
        ///</summary>
        [Column("last_trade_time")]
        public string? LastTradeTime { get; set; }

        /// <summary>
        /// 银行账户开户机构
        ///</summary>
        [Column("open_institution")]
        public string? OpenInstitution { get; set; }

        /// <summary>
        /// 银行账户状态(713000000：开户待确认 713000001：正常 713000003：挂失结清 713000004：开户更正 713000005：临时销户 713000006：销户  713000007：计息结束   )
        ///</summary>
        [Column("bank_account_state")]
        public string? BankAccountState { get; set; }

        #region IEntity 成员

        [Ignore]
        object IEntity.EntityId { get { return Id; } }

        #endregion IEntity 成员
    }
}